package com.lkm.market2_0.m_imple.steelyardserver.server;

import com.lkm.market2_0.m_imple.steelyardserver.server.cmd_handle.CMDBtnModifyHandle;
import com.lkm.market2_0.m_imple.steelyardserver.server.cmd_handle.CMDClearAndColseBtnHandle;
import com.lkm.market2_0.m_imple.steelyardserver.server.cmd_handle.CMDHeartbeatHandle;
import com.lkm.market2_0.m_imple.steelyardserver.server.cmd_handle.CMDInitValue0Handle;
import com.lkm.market2_0.m_imple.steelyardserver.server.cmd_handle.CMDInputSetOkPasswordHandle;
import com.lkm.market2_0.m_imple.steelyardserver.server.cmd_handle.CMDPrintHandle;
import com.lkm.market2_0.m_imple.steelyardserver.server.cmd_handle.CMDHistoryPrintADHandle;
import com.lkm.market2_0.m_imple.steelyardserver.server.cmd_handle.CMDHistoryPrintHandle;
import com.lkm.market2_0.m_imple.steelyardserver.server.cmd_handle.CMDInitValueHandle;
import com.lkm.market2_0.m_imple.steelyardserver.server.cmd_handle.CMDScanAndDelegatePayHandle;
import com.lkm.market2_0.m_imple.steelyardserver.server.cmd_handle.CMDSyncBtnHandle;
import com.lkm.market2_0.m_imple.steelyardserver.server.cmd_handle.CMDWeightADHandle;
import com.lkm.market2_0.m_imple.steelyardserver.server.cmd_handle.CMDKeyHandle;
import com.lkm.market2_0.m_imple.steelyardserver.server.cmd_handle.CMDSubtotalAndHeadHandle;
import com.lkm.market2_0.m_imple.steelyardserver.server.cmd_handle.CMDSubtotalHandle;
import com.lkm.market2_0.m_imple.steelyardserver.server.cmd_handle.CMDWeightChangeHandle;



public class CMDFactory {

    protected static CMDClearAndColseBtnHandle cmdClearAndColseBtnHandle=new CMDClearAndColseBtnHandle();
    protected static CMDSyncBtnHandle cmdSyncBtnHandle=new CMDSyncBtnHandle();
    protected static CMDScanAndDelegatePayHandle cmdScanPayHandle=new CMDScanAndDelegatePayHandle();
    protected static CMDHeartbeatHandle cmdHeartbeatHandle=new CMDHeartbeatHandle();
    protected static CMDPrintHandle cmdPrintHandle=new CMDPrintHandle();
    protected static CMDWeightChangeHandle cmdWeightChangeHandle=new CMDWeightChangeHandle();
    protected static CMDInputSetOkPasswordHandle cmdInputSetOkPasswordHandle=new CMDInputSetOkPasswordHandle();
    protected static CMDHistoryPrintHandle cmdHistoryPrintHandle=new CMDHistoryPrintHandle();
    protected static CMDHistoryPrintADHandle cmdHistoryPrintADHandle=new CMDHistoryPrintADHandle();

    protected static CMDWeightADHandle cmdWeightADHandle=new CMDWeightADHandle();

    protected static CMDSubtotalAndHeadHandle cmdSubtotalAndHeadHandle=new CMDSubtotalAndHeadHandle();
    protected static CMDSubtotalHandle cmdSubtotalHandle=new CMDSubtotalHandle();

    protected static CMDKeyHandle cmdKeyHandle=new CMDKeyHandle();

    protected static CMDInitValueHandle cmdInitValueHandle = new CMDInitValueHandle();

    protected static CMDInitValue0Handle cmdInitValue0Handle = new CMDInitValue0Handle();
    protected static CMDBtnModifyHandle cmdBtnModifyHandle = new CMDBtnModifyHandle();

    public static ICMDHandle createICMDHandleByCMDEntity(CMDEntity cmdEntity) {
        ICMDHandle icmdHandle=null;
        byte cmd=cmdEntity.getCmd();
        switch (cmd){
            
            case (byte)0x06:
                icmdHandle=cmdHeartbeatHandle;
                break;
            
            case (byte)0x01:
                icmdHandle=cmdPrintHandle;
                break;
            case (byte)0x13: 
                icmdHandle=cmdPrintHandle;
                break;
            case (byte)0x02:
                icmdHandle=cmdSubtotalAndHeadHandle;
                break;
            case (byte)0x03:
                icmdHandle=cmdSubtotalHandle;
                break;
            
            case (byte)0x08:
                icmdHandle=cmdWeightChangeHandle;
                break;
            case (byte)0x07:
                icmdHandle=cmdInputSetOkPasswordHandle;
                break;
            case (byte)0x0D:
                icmdHandle=cmdHistoryPrintHandle;
                break;
            case (byte)0x0F:
                icmdHandle=cmdHistoryPrintADHandle;
                break;
            case (byte)0x0E:
                icmdHandle=cmdWeightADHandle;
                break;
            case (byte)0x10:
                icmdHandle=cmdKeyHandle;
                break;
            case (byte)0x12:
                icmdHandle=cmdInitValueHandle;
                break;
            case (byte)0x14:
                icmdHandle=cmdInitValue0Handle;
                break;
            case (byte) 0x19:
            case (byte) 0x1a:
                icmdHandle = cmdScanPayHandle;
                break;
            case (byte)0x04:
                icmdHandle=cmdSyncBtnHandle;
                break;
            case (byte)0x1D:
                icmdHandle=cmdClearAndColseBtnHandle;
                break;
            case (byte)0x1E:
                icmdHandle=cmdBtnModifyHandle;
                break;
        }
        return icmdHandle;
    }

}
